/***************************************************************************
 *   Copyright (C) 2009 by maarten,,,   *
 *   maarten@maarten-laptop   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "scenemanager/scene/scene.h"
#include "scenemanager/camera/camera.h"

#include "scenemanager/scene/subscene.h"

#include "cgpanel/floatmatrix.h"

#include <iostream>
using namespace std;

namespace scene {

Scene::Scene(Camera *camera, QVector<SceneElement*> *lights, QColor bgColor,
int aa)
{
    m_cam = camera;
    m_lights = lights;
    m_bgColor = bgColor;
    m_antiAliasing = aa;
}



Scene::~Scene()
{
    // Do not delete cam, lights en bgcolor => will be deleted in tha manager
    
    // delete subscenes
    for(int i = 0; i< m_subScenes.size(); ++i)
      delete m_subScenes[i];
    
    m_subScenes.clear();
    
}

void Scene::printElement()
{
    cout << "Scene:\n";
    cout << " * cam:" << m_cam->name().toStdString() << endl;
    for(int i = 0; i< m_lights->size(); ++i)
      cout << " * light:" << m_lights->at(i)->name().toStdString() << endl;
    
    cout << "--------------------------------------" << endl;
}

}
